package com.hbu.whtk.JsonReturnCs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class Replydict {

	
	
	public Replydict(ArrayList<HashMap<String, ArrayList<Cmnt>>> list) {
		super();
		this.list = list;
	}
	String s;
	ArrayList<HashMap<String, ArrayList<Cmnt>>> list=new ArrayList<HashMap<String,ArrayList<Cmnt>>>();
	HashMap<String, ArrayList<Cmnt>> m=new HashMap<String, ArrayList<Cmnt>>();
	ArrayList<Cmnt> a=new ArrayList<Cmnt>();
	//ArrayList<HashMap<String, String>> 
	public Replydict(String s) {
		// TODO Auto-generated constructor stub
		this.s=s;
	}
	public void paserReplydict()
	{
		if(s==null) return;
	     JSONObject o=JSON.parseObject(s);
	   if(o==null&&o.entrySet().size()==0) return;
		   
	     Iterator iterator=o.entrySet().iterator(); 
	    
	        while(iterator.hasNext()){       
	              Map.Entry<String, JSONArray> entry= (Entry<String, JSONArray >) iterator.next(); 
	              // System.out.println("key:"+entry.getKey()+" value"+((JSONArray)entry.getValue()).get(0).toString() );
	              Cmnt c;
	              JSONArray ja=(JSONArray)entry.getValue();
	              
	              for (Object o1 :ja)
	              {
	            	 String s1=o1.toString();
	            	 c=JSON.parseObject(s1,Cmnt.class);
	            	 a.add(c);  
	              }
	              m.put(entry.getKey(), a);
	              list.add(m);
	              
	            }        
	 //  c=(HashMap<String, ArrayList<Cmnt>>) o.entrySet();
	//ArrayList<Cmnt> lis=(ArrayList<Cmnt>) ((HashMap)list.get(0)).get("5668D6E2-6FA11444-152BB01C9-8C4-8F45");
	
//	System.out.println(lis.get(0).getStatus()+" "+lis.get(0).getUsertype());
	}
	

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

	public ArrayList<HashMap<String, ArrayList<Cmnt>>> getList() {
		return list;
	}

	public void setList(ArrayList<HashMap<String, ArrayList<Cmnt>>> list) {
		this.list = list;
	}
	public String getS() {
		return s;
	}
	public void setS(String s) {
		this.s = s;
	}

}
